package com.jxy.bean.constant;

import com.jxy.bean.ClassFile;
import com.jxy.tool.Tool;

import java.io.DataInputStream;

public class DoubleInfo extends ConstantPool {
    public double bytes;
    //是否为扩展位,默认不是
    private boolean ext = false;

    public DoubleInfo(ClassFile cf) {
        super(ConstantPoolTag.CONSTANT_Double.getTag(), cf);
        //不读取数据则为扩展位
        ext = true;
    }

    public DoubleInfo(DataInputStream dis, ClassFile cf) {
        super(ConstantPoolTag.CONSTANT_Double.getTag(), cf);
        bytes = Tool.readDouble(dis);
    }

    @Override
    public String toString() {
        return ConstantPoolTag.CONSTANT_Double.getType() + "{tag:" + tag + ", bytes=" + (ext ? "large numeric continued" : bytes) + "}";
    }
}
